"""后缀表达式求值"""
from ADT import Stack


def compute(x, y, opt):
    if opt == '+':
        return x + y
    elif opt == '-':
        return x - y
    elif opt == '*':
        return x * y
    else:
        return x / y


def hou_value(ex):
    stack = Stack()
    for s in ex:
        if s not in '+-*/':
            stack.push(s)
        else:
            b = int(stack.pop())
            a = int(stack.pop())
            stack.push(compute(a, b, s))
    return stack.pop()


ex = list(input().strip().split())
print(hou_value(ex))
# 11 2 3 * +

